Some legacy filters are replaced in structured UI by new filters.
It's important that their default value doesn't cause them
to filter the results when they are not even visible to the
user.
Bug: T162158
Change-Id: I3ff09164bbc0d14283302aa37bdee2c7ef9f5eb3
}
/**
+ * Get the default value
+ *
+ * @param bool $structuredUI Are we currently showing the structured UI
* @return bool|null Default value
*/
- public function getDefault() {
- return $this->defaultValue;
+ public function getDefault( $structuredUI = false ) {
+ return $this->isReplacedInStructuredUi && $structuredUI ?
+ false :
+ $this->defaultValue;
}
/**
public function getDefaultOptions() {
$config = $this->getConfig();
$opts = new FormOptions();
+ $structuredUI = $this->getUser()->getOption( 'rcenhancedfilters' );
// Add all filters
foreach ( $this->filterGroups as $filterGroup ) {
$opts->add( $filterGroup->getName(), $filterGroup->getDefault() );
} else {
foreach ( $filterGroup->getFilters() as $filter ) {
- $opts->add( $filter->getName(), $filter->getDefault() );
+ $opts->add( $filter->getName(), $filter->getDefault( $structuredUI ) );
}
}
}